<?php
if( !function_exists('scandir') ) {
    function scandir($directory, $sorting_order = 0) {
        $dh  = opendir($directory);
        while( false !== ($filename = readdir($dh)) ) {
            $files[] = $filename;
        }
        if( $sorting_order == 0 ) {
            sort($files);
        } else {
            rsort($files);
        }
        return($files);
    }
}

if(!function_exists('file_put_contents')) {
 function file_put_contents($filename, $data, $file_append = false) {
  $fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
  if(!$fp) {
   return false;
  }
  fputs($fp, $data);
  fclose($fp);
  return true;
 }
}

?>